﻿<UserControl x:Class="HandGenerator.Controls.StartingHandsGrid"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:shglb="clr-namespace:HandGenerator.Controls"
             mc:Ignorable="d" >
    <UserControl.Resources>

        <Style x:Key="THCTextBlockControlHeaderCenter" TargetType="TextBlock">
            <Setter Property="HorizontalAlignment" Value="Stretch" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="TextAlignment" Value="Center" />
            <Setter Property="FontWeight" Value="SemiBold" />
            <Setter Property="FontSize" Value="24" />
        </Style>

        <Style x:Key="THCTextBlockDataHeaderCenter" TargetType="Button">
            <Setter Property="HorizontalAlignment" Value="Stretch" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="FontWeight" Value="SemiBold" />
            <Setter Property="FontSize" Value="24" />
            <EventSetter Event="Click" Handler="StartingHandSelectionClick" />
        </Style>

        <shglb:StartingHandConverter x:Key="HandConverter" />
        <shglb:CardRowConverter x:Key="HandRowConverter" />
        <shglb:CardColumnConverter x:Key="HandColConverter" />
        <shglb:StartingHandHighlightConverter x:Key="HighlightConverter" />
        <shglb:StartingHandVisibilityConverter x:Key="VisibilityConverter" />
        <shglb:StartingHandBorderHighlightConverter x:Key="VisibleBorderConverter" />

        <DataTemplate x:Key="StartingHandsDataTemplate">
            <Button Content="{Binding Converter={StaticResource HandConverter}}"
                    Background="{Binding Converter={StaticResource HighlightConverter}}" 
                    Style="{StaticResource THCTextBlockDataHeaderCenter}" 
                    BorderBrush="{ Binding Converter={StaticResource VisibleBorderConverter}}"/>
        </DataTemplate>

        <Style x:Key="StartingHandsContainerStyle" TargetType="{x:Type FrameworkElement}">
            <Setter Property="Grid.Row" Value="{Binding Converter={StaticResource HandRowConverter}}" />
            <Setter Property="Grid.Column" Value="{Binding Converter={StaticResource HandColConverter}}" />
        </Style>

        <ItemsPanelTemplate x:Key="StartingHandsItemsPanelTemplate">
            <Grid Name="ItemsPanelGrid">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
            </Grid>
        </ItemsPanelTemplate>

    </UserControl.Resources>

    <Grid x:Name="StartingHandsGridCtrl">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <!-- Starting Hand Card Header Rows -->
        <TextBlock Text="A" Name="R00C00" Grid.Row="1" Grid.Column="0" Style="{StaticResource THCTextBlockControlHeaderCenter}"  />
        <TextBlock Text="K" Name="R01C00" Grid.Row="2" Grid.Column="0" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="Q" Name="R02C00" Grid.Row="3" Grid.Column="0" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="J" Name="R03C00" Grid.Row="4" Grid.Column="0" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="10" Name="R04C00" Grid.Row="5" Grid.Column="0" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="9" Name="R05C00" Grid.Row="6" Grid.Column="0" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="8" Name="R06C00" Grid.Row="7" Grid.Column="0" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="7" Name="R07C00" Grid.Row="8" Grid.Column="0" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="6" Name="R08C00" Grid.Row="9" Grid.Column="0" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="5" Name="R09C00" Grid.Row="10" Grid.Column="0" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="4" Name="R10C00" Grid.Row="11" Grid.Column="0" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="3" Name="R11C00" Grid.Row="12" Grid.Column="0" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="2" Name="R12C00" Grid.Row="13" Grid.Column="0" Style="{StaticResource THCTextBlockControlHeaderCenter}" />

        <TextBlock Text="A" Name="R00C01" Grid.Row="0" Grid.Column="1" Style="{StaticResource THCTextBlockControlHeaderCenter}"  />
        <TextBlock Text="K" Name="R00C02" Grid.Row="0" Grid.Column="2" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="Q" Name="R00C03" Grid.Row="0" Grid.Column="3" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="J" Name="R00C04" Grid.Row="0" Grid.Column="4" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="10" Name="R00C05" Grid.Row="0" Grid.Column="5" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="9" Name="R00C06" Grid.Row="0" Grid.Column="6" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="8" Name="R00C07" Grid.Row="0" Grid.Column="7" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="7" Name="R00C08" Grid.Row="0" Grid.Column="8" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="6" Name="R00C090" Grid.Row="0" Grid.Column="9" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="5" Name="R00C10" Grid.Row="0" Grid.Column="10" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="4" Name="R00C11" Grid.Row="0" Grid.Column="11" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="3" Name="R00C12" Grid.Row="0" Grid.Column="12" Style="{StaticResource THCTextBlockControlHeaderCenter}" />
        <TextBlock Text="2" Name="R00C13" Grid.Row="0" Grid.Column="13" Style="{StaticResource THCTextBlockControlHeaderCenter}" />

        <ItemsControl 
            Name="StartingHandsItemControl"
            Grid.Row="1" Grid.Column="1" Grid.RowSpan="13" Grid.ColumnSpan="13"
            ItemTemplate="{StaticResource StartingHandsDataTemplate}"
            ItemsPanel="{StaticResource StartingHandsItemsPanelTemplate}"
            ItemsSource="{Binding AllHands}" 
            ItemContainerStyle="{StaticResource StartingHandsContainerStyle}" />
            
    </Grid>
</UserControl>
